package com.itheima.mapper;

import com.itheima.entity.ClassQueryParam;
import com.itheima.entity.Clazz;
import com.itheima.entity.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ClassMapper {
    /**
     * 分页查询
     * @param param
     * @return
     */
    List<Clazz> list(ClassQueryParam param);

    /**
     * 新增
     * @param clazz
     */
    void add(Clazz clazz);

    /**
     * 删除
     * @param id
     */
    @Delete("delete from clazz where id = #{id}")
    void deleteById(Integer id);

    /**
     * 根据id查询班级
     * @param id
     * @return
     */
    @Select("select * from clazz where id = #{id}")
    Clazz selectById(Integer id);

    //xml开发
    void update(Clazz clazz);

    /**
     * 查询所有班级
     */
    @Select("select * from clazz")
    List<Clazz> selectAll();

    /**
     * 查询班级员工
     * @return
     */
    @Select("select * from emp")
    List<Emp> selectEmp();

}
